A conventional query optimization method, as disclosed in U.S. Pat. No. 5,590,321, includes the steps of: determining whether all data referred to in a query is contained in one external database; and determining whether functions in the query can be executed in the one external database, and when all data contained in the query is contained in one database and all the functions in the query can be evaluated in the external database, the query is executed in the external database.
It is desirable that whether functions in a query can be executed or are desirably executed in external databases is decided by how users use data bases in the interest of optimization, based on users' experience and knowledge such as function names, the format of data contained in the external databases, and how the functions are used in the query. However, in the prior art, whether functions contained in a query can be executed in external databases depends on a database management system having the function of accessing external databases. Consequently, query optimization as intended by users cannot be achieved and query execution performance is reduced. This has been a problem of the prior art.
An object of the present invention is to provide a database management system that can apply a user-intended database utilization method to query optimization by enabling users to specify execution places of functions in a query, a query method in the database management system, and a query execution program in the database management system, and particularly to achieve query optimization in them.
Another object of the present invention is to provide a query optimization method that permits users to specify execution places of functions in the query for each of types of database management systems, each of types and version of database management systems, and each of databases.